//
//  WelcomeViewController.swift
//  KKWB
//
//  Created by KSY-iOS on 17/1/13.
//  Copyright © 2017年 KK. All rights reserved.
//

import UIKit
import SDWebImage

class WelcomeViewController: UIViewController {

    // MARK:- 属性
    @IBOutlet weak var avatarViewBottomConstraint: NSLayoutConstraint!
    
    @IBOutlet weak var avatarView: UIImageView!
    // MARK:- 系统回调
    override func viewDidLoad() {
        super.viewDidLoad()

        let avatarPath = UserAccountViewModel.shareInstance.account?.avatar_large
        
        let url = URL(string: avatarPath ?? "")
        
        avatarView.sd_setImage(with: url, placeholderImage: UIImage(named:"avatar_default_big"))
        
        avatarViewBottomConstraint.constant = UIScreen.main.bounds.height - 250
        
        UIView.animate(withDuration: 1.0, delay: 0, usingSpringWithDamping: 0.7, initialSpringVelocity: 5.0, options: [], animations: {
            
            self.view.layoutIfNeeded()
        }) { (_) in
            
            UIApplication.shared.keyWindow?.rootViewController = UIStoryboard(name: "Main", bundle: nil).instantiateInitialViewController()
        }
        
    }

}
